
package presentacion;

import accesoDatos.GestorAsignacion;
import accesoDatos.GestorEspera;
import accesoDatos.GestorEstudiante;
import accesoDatos.GestorMaquina;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import logicaNegocio.Espera;

/**
 *
 * @author hernaldo
 */
public class ListaEspera extends javax.swing.JFrame {
    
    private GestorEspera gestorEsp;
    private GestorEstudiante gestorEst;
    private GestorAsignacion gestorA;
    private GestorMaquina gestorM;
    private ArrayList<Espera> listaEnEspera;

    /** Creates new form ListaSancionados */
    public ListaEspera() {
        initComponents();
        setLocationRelativeTo(null);
        this.mensajeAyuda();
    }

    private void mensajeAyuda(){
        this.txt_NombreEstudiante.setToolTipText("Debe escribir el nombre completo del estudiante. Solo puede digitar Letras");
        this.txt_CedulaEstudiante.setToolTipText("Escriba el numero de cedula con el formato: \"X-XXXX-XXXX\", incluyendo los ceros \"0\"");
    }
    
    public void getGestores(GestorEspera ge1, GestorEstudiante ge2, GestorAsignacion ga,
            GestorMaquina gm){
        this.gestorEsp = ge1;
        this.gestorEst = ge2;
        this.gestorA = ga;
        this.gestorM = gm;
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        txt_CedulaEstudiante = new javax.swing.JTextField();
        lb_NombreEstudiante = new javax.swing.JLabel();
        txt_NombreEstudiante = new javax.swing.JTextField();
        btn_Ingresar = new javax.swing.JButton();
        btn_Modificar = new javax.swing.JButton();
        btn_Eliminar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tb_ListaEspera = new javax.swing.JTable();
        btn_Asignar = new javax.swing.JButton();
        lb_NombreEstudiante1 = new javax.swing.JLabel();
        btn_Cancelar = new javax.swing.JButton();

        setTitle("Lista de Espera");
        setName("Lista de Espera"); // NOI18N

        lb_NombreEstudiante.setText("Nombre Completo:");

        btn_Ingresar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/Agregar.png"))); // NOI18N
        btn_Ingresar.setText("Ingresar");
        btn_Ingresar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_IngresarActionPerformed(evt);
            }
        });

        btn_Modificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/Editar.png"))); // NOI18N
        btn_Modificar.setText("Modificar");
        btn_Modificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_ModificarActionPerformed(evt);
            }
        });

        btn_Eliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/Eliminar.png"))); // NOI18N
        btn_Eliminar.setText("Eliminar");
        btn_Eliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_EliminarActionPerformed(evt);
            }
        });

        tb_ListaEspera.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"1", null, null, null, null},
                {"2", null, null, null, null},
                {"3", null, null, null, null},
                {"4", null, null, null, null},
                {"5", null, null, null, null},
                {"6", null, null, null, null},
                {"7", null, null, null, null},
                {"8", null, null, null, null},
                {"9", null, null, null, null},
                {"10", null, null, null, null}
            },
            new String [] {
                "Orden", "Nombre Completo", "Cedula", "Fecha", "Hora"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tb_ListaEspera);

        btn_Asignar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/Aceptar.png"))); // NOI18N
        btn_Asignar.setText("Asignar");
        btn_Asignar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_AsignarActionPerformed(evt);
            }
        });

        lb_NombreEstudiante1.setText("Cédula:");

        btn_Cancelar.setFont(new java.awt.Font("Tahoma", 1, 11));
        btn_Cancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/presentacion/imagenes/Cancelar.png"))); // NOI18N
        btn_Cancelar.setText("Cancelar");
        btn_Cancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 389, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lb_NombreEstudiante)
                                    .addComponent(lb_NombreEstudiante1))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txt_CedulaEstudiante)
                                    .addComponent(txt_NombreEstudiante, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(97, 97, 97)
                        .addComponent(btn_Cancelar)
                        .addGap(18, 18, 18)
                        .addComponent(btn_Asignar))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(btn_Ingresar)
                        .addGap(18, 18, 18)
                        .addComponent(btn_Modificar)
                        .addGap(18, 18, 18)
                        .addComponent(btn_Eliminar)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lb_NombreEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txt_NombreEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_CedulaEstudiante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lb_NombreEstudiante1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_Ingresar)
                    .addComponent(btn_Modificar)
                    .addComponent(btn_Eliminar))
                .addGap(33, 33, 33)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_Asignar)
                    .addComponent(btn_Cancelar, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btn_AsignarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_AsignarActionPerformed
       Asignacion a = new Asignacion();
       String cedulaBuscar = this.txt_CedulaEstudiante.getText();
       a.RecibeCedula(cedulaBuscar);
       a.setVisible(true);
    }//GEN-LAST:event_btn_AsignarActionPerformed

    private boolean camposVacios(){
        if(this.txt_CedulaEstudiante.getText().equals(""))
            return true;
        else if(this.txt_NombreEstudiante.getText().equals(""))
            return true;
        else
            return false;
    }
    
    private void btn_IngresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_IngresarActionPerformed
    
        if(!this.camposVacios()){
            //Espera espera = new Espera(null, null, WIDTH);
        }
        else{
            JOptionPane.showMessageDialog(rootPane, "Cedula y/o Nombre del Estudiante Incorrectos");
        }
    }//GEN-LAST:event_btn_IngresarActionPerformed

    private void btn_ModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_ModificarActionPerformed
   
    }//GEN-LAST:event_btn_ModificarActionPerformed

    private void btn_EliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_EliminarActionPerformed
 
    }//GEN-LAST:event_btn_EliminarActionPerformed

private void btn_CancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CancelarActionPerformed
    setVisible(false);
}//GEN-LAST:event_btn_CancelarActionPerformed

    /**
    * @param args the command line arguments
    */
 

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_Asignar;
    private javax.swing.JButton btn_Cancelar;
    private javax.swing.JButton btn_Eliminar;
    private javax.swing.JButton btn_Ingresar;
    private javax.swing.JButton btn_Modificar;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lb_NombreEstudiante;
    private javax.swing.JLabel lb_NombreEstudiante1;
    private javax.swing.JTable tb_ListaEspera;
    private javax.swing.JTextField txt_CedulaEstudiante;
    private javax.swing.JTextField txt_NombreEstudiante;
    // End of variables declaration//GEN-END:variables

}
